﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using TimeTravel.Components;
using TimeTravel.Extentions;

namespace TimeTravel.IData
{
    public interface IDataBase<T> where T : BaseComponent, new()
    {
        /// <summary>
        /// 添加记录
        /// </summary>
        int Add(T t);
        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="id"></param>
        void Delete(int id);
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="t"></param>
        void Update(T t);
        /// <summary>
        /// 获取所有
        /// </summary>
        /// <returns></returns>
        IList<T> GetAll();
        /// <summary>
        /// 根据条件获取
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        RecordSet<T> GetBySearch(PageQueryInfo query);
        /// <summary>
        /// 获取详细信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        T GetOne(int id);
        /// <summary>
        /// 获取总数
        /// </summary>
        /// <returns></returns>
        int GetTotalCount();
    }
}
